From: Aki Tuomi Date: Mon, 22 Dec 2025 09:05:31 +0000 (+0200) Subject: [PATCH] lib-regex: Set DREGEX_MAX_MATCHES to library default X-Git-Tag: archive/raspbian/1%2.4.2+dfsg1-3+rpi1^2~3 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=e4c6a34495e792e6ed21723efed7b07416dc8668;p=dovecot.git [PATCH] lib-regex: Set DREGEX_MAX_MATCHES to library default Gbp-Pq: Name lib-regex_Set_DREGEX_MAX_MATCHES_to_library_default.patch --- diff --git a/src/lib-regex/regex.c b/src/lib-regex/regex.c index 51e7d6c..5ccf9d5 100644 --- a/src/lib-regex/regex.c +++ b/src/lib-regex/regex.c @@ -14,7 +14,7 @@ #include "pcre2.h" #define DREGEX_MAX_DEPTH 100 -#define DREGEX_MAX_MATCHES 100 +#define DREGEX_MAX_MATCHES 10000000 #define DREGEX_MAX_CAPTURE_GROUPS 100 #define DREGEX_MAX_CPU_SECONDS 1 diff --git a/src/lib-regex/test-regex.c b/src/lib-regex/test-regex.c index 10b393e..4b68bca 100644 --- a/src/lib-regex/test-regex.c +++ b/src/lib-regex/test-regex.c @@ -158,19 +158,21 @@ static void test_dregex_match(void) "{1}[a-z0-9]+[.]{1}(([a-z]{2,3})|([a-z]{2,3}[.]" "{1}[a-z]{2,3}))$", "thisisabstractly.andtotally.long.email@" - REP10("a") "." REP10("a") "." REP10("a") + REP10(REP10("a") "." REP10("a") "." REP10("a") "." REP10("a")) ".has", - "match limit exceeded", + "matching depth limit exceeded", 0, -1 ), MATCH_CASE_FULL( "(a|a?)+", - REP10("a") REP10("a"), - "match limit exceeded", + REP10(REP10("a") REP10("a") REP10("a")), + "matching depth limit exceeded", 0, -1 ), + /* Live test cases */ + MATCH_CASE("\\[.*PATCH.*\\]", "Subject: Re: [PATCH v2 3/6] arm64: dts: qcom: qcm6490-shift-otter: Ad"), /* IEEE.1003-2.1992 */ MATCH_CASE("me(\\+.*)?@company\\.com", "me+hello@company.com"),